import store from "@/store";
import dayjs from 'dayjs';
console.log(88);
export const formItemStyle = {
  paddingLeft: "20px",
};

export const cellStyle = {
  background: "rgba(28, 155, 252, 0.02)",
  color: "rgb(142, 155, 185)",
  textAlign: "center",
};

// 表头单元格样式
export const headerCellStyle = {
  background: "rgba(28, 155, 252, 0.02)",
  color: "rgb(142, 155, 185)",
  textAlign: "center",
};

// 表格内表单子样式
export const tableFormStyle = {
  marginBottom: 0,
};


export const formBase = [ 
  {
    label: '消费时间',
    type: 'daterange',
    field: 'shelfTime',
    prop: 'shelfTime',
    required: true,
    otherOptions: {
      disabled: false,
      rangeSeparator: '至',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      pickerOptions: {
        shortcuts: [ {
          text: "今天",
          onClick(picker) {
            const end = dayjs().format("YYYY-MM-DD 23:59:59");
            const start = dayjs().format("YYYY-MM-DD 00:00:00");
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "昨天",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            end.setTime(start.getTime() - 3600 * 1000 * 24);
            start.setTime(start.getTime() - 3600 * 1000 * 24);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近三天",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 3);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近一周",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit("pick", [start, end]);
          },
        },
        {
          text: "最近一个月",
          onClick(picker) {
            const end = new Date(dayjs().format("YYYY-MM-DD 23:59:59"));
            const start = new Date(dayjs().format("YYYY-MM-DD 00:00:00"));
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit("pick", [start, end]);
          },
        },]
      }
    }
  }, 
  { 
    label: "订单号",
    type: "input", 
    field: "orderNos",
  },  
  { 
    label: "会员ID",
    type: "input", 
    field: "userId",
  },  
  { 
    label: "会员名",
    type: "input", 
    field: "userName",
  },  
  { 
    label: "淘宝订单编号",
    type: "input", 
    field: "taoBaoPaymentOrderId",
  },  
  {
    label: '消费类型',
    type: 'select',
    field: 'consumerType',
    optionsKey: 'label',
    optionsValue: 'value',
    options: [
      {
        label: '未启用',
        value: 0
      }, {
        label: '已启用',
        value: 1
      }
    ],
  }, 
  {
    label: "所属店铺",
    type: "select",
    field: "ownedStore",
    optionsKey: "shopName",
    optionsValue: "id",
    options: store.state.custom_dict.shop,
    otherOptions: {
      multiple:true
    }
  },  
  { 
    label: "说明",
    type: "input", 
    field: "expenseType",
  },  
];

export const tableBase = [
  {
    label: "所属店铺",
    prop: "ownedStore", 
    width: "200", 
  },  
  {
    label: "付款码",
    prop: "paymentCode", 
    width: "200", 
  },  
  {
    label: "集包单号",
    prop: "transferOrderNumber", 
    width: "200", 
  },  
  {
    label: "说明",
    prop: "expenseType", 
    width: "200", 
  },  
  {
    label: "会员ID",
    prop: "userId", 
    width: "200", 
  },  
  {
    label: "会员名",
    prop: "userName", 
    width: "200", 
  },  
  {
    label: "变动前余额",
    prop: "expenseBefore", 
    width: "200", 
  },  
  {
    label: "变动余额",
    prop: "expenseAmount", 
    width: "200", 
  },  
  {
    label: "变动后余额",
    prop: "expenseAfter", 
    width: "200", 
  },  
  {
    label: "淘宝交易号",
    prop: "taoBaoPaymentOrderId", 
    width: "200", 
  },  
  {
    label: "操作员",
    prop: "private", 
    width: "200", 
  },  
  {
    label: "集运券",
    prop: "useCollectionCoupon", 
    width: "200", 
  },  
  {
    label: "消费类型",
    prop: "consumerType", 
    width: "200", 
  },  
  {
    label: "是否执行",
    prop: "isExecute", 
    width: "200", 
    slotName: 'isExecute'
  },  
  {
    label: "创建时间",
    prop: "createTime", 
    width: "200", 
  },  
];
 
